<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	function one_write(sessionId) {
		var one=themaDetail.one_content.value;
		if(sessionId==null){
			alert('로그인후 이용하세요  ');
			return false;
		}
		if(one=="" || one.length<5 ){
			alert('글자를 5자 이상 입력하세요 ');
			return false;
		}
		return true;
	}
</script>
</head>
<body>	
<table align="center" border="1">
<c:forEach items="${themaDtoList}" var="themaDto">
	<tr>
		<td colspan="2" align="right">
			<a href="/food/thema/themaSelectList?nowPage=${nowPage}">목록으로</a>
		</td>
	</tr>
	<tr>
	<c:if test="${sessionId==themaDto.member_id }">
		<td>
			<a href="/food/thema/themaUpdate?thema_num=${themaDto.thema_num}&nowPage=${nowPage}">글수정</a>
			<a href="/food/thema/themaDelete?thema_num=${themaDto.thema_num}">삭제하기</a>
		</td>
	</tr>
	</c:if>
	<tr >
		<td><img src="/food/resources/thema/${themaDto.thema_image}" width="50" height="50"></td>
		<td>
			${themaDto.thema_subject} &nbsp;&nbsp;${themaDto.thema_category2} <br/>
			글번호 : ${themaDto.member_id} 
			&nbsp;|&nbsp;조회수 : ${themaDto.thema_readcnt}
			&nbsp;|&nbsp;평점 : ${themaDto.thema_score/themaDto.thema_participant }
		</td>
	</tr>
	<tr>
		<td width="400" height="500" colspan="2">
			${themaDto.thema_content}		
		</td>
		
	</tr>
</table>

<form name="themaDetail" action="/food/thema/theamOneInsert" method="post">
<table align="center">
	<tr>
		<td>
			<select name="one_score">
				<option value="5">★★★★★</option>
				<option value="4">★★★★</option>
				<option value="3">★★★</option>
				<option value="2">★★</option>
				<option value="1">★</option>
			</select>
		</td>
		<td>
			<input type="hidden" name="member_id" value="${sessionId}">
			<input type="hidden" name="thema_num" value="${themaDto.thema_num}">
			<input type="hidden" name="nowPage" value="${nowPage}">
			<input type="text" name="one_content" id="one_content" value="">
		</td>
		<td>
			<input type="submit" onclick="return one_write(${sessionId})" value="작성">
		</td>
		
	</tr>
	<tr>
		<td>별점평가
		</td>
		<td>아이디
		</td>
		<td>내용
		</td>
	</tr>
	<c:forEach items="${themaOneDtoList}" var="themaOneDto">
	<tr>
		<td>
			<c:choose>
				<c:when test="${themaOneDto.one_score==5}">★★★★★</c:when>
				<c:when test="${themaOneDto.one_score==4}">★★★★</c:when>
				<c:when test="${themaOneDto.one_score==3}">★★★</c:when>
				<c:when test="${themaOneDto.one_score==2}">★★</c:when>
				<c:when test="${themaOneDto.one_score==1}">★</c:when>
			</c:choose>	
		</td>
		<td>${themaOneDto.member_id}</td>
		<td>${themaOneDto.one_content}</td>
		<td>
			<c:if test="${sessionId== themaOneDto.member_id}">
				<a href="/food/thema/themaOneDelete?one_num=${themaOneDto.one_num}&thema_num=${themaDto.thema_num}&nowPage=${nowPage}" >삭제</a>
			</c:if>
		</td>
	</tr>
	</c:forEach>
</c:forEach>
</table>
</from>
</body>
</html>